1. Field of the Invention
The present invention relates to a semiconductor device provided with a current setting circuit for setting a current used in an internal circuit of the semiconductor device with the use of an external resistor.
2. Description of the Related Art
Conventionally, a current generating circuit as shown in FIG. 8 (see, for example, patent document 1) or FIG. 9 (see, for example, patent document 2) is used for generating a current necessary for operating an internal circuit of a semiconductor device.
The current generating circuit shown in FIG. 8 includes a reference voltage generating circuit 101 for generating and outputting a reference voltage Vref; an operational amplifying circuit 102; PMOS transistors M101 and M102; and a resistor R101. The operational amplifying circuit 102 controls the gate voltage of the PMOS transistor M101 so that the voltage decline of the resistor R101 becomes equal to the reference voltage Vref. As a result, the resistor R101 receives a current i101 (=Vref/r101) that is determined by the reference voltage Vref and a resistance r101 of the resistor R101. The current i101 is also the drain current of the PMOS transistor M101. The sources and the gates of the PMOS transistors M101 and M102 are connected to each other, and therefore a drain current iout of the PMOS transistor M102 is output as a current proportional to the current i101.
The current generating circuit shown in FIG. 9 includes the reference voltage generating circuit 101, the operational amplifying circuit 102, the PMOS transistors M101 and M102, an NMOS transistor M103, and the resistor R101. The operational amplifying circuit 102 controls the gate voltage of the NMOS transistor M103 so that the voltage decline of the resistor R101 becomes equal to the reference voltage Vref. As a result, the resistor R101 receives a current i101 (=Vref/r101) that is determined by the reference voltage Vref and the resistor R101. The current i101 is also the drain current of the PMOS transistor M101 and the NMOS transistor M103. The PMOS transistors M101 and M102 constitute a current mirror circuit, and therefore the drain current iout of the PMOS transistor M102 is output as a current proportional to the current i101.
The appropriate one of the current generating circuits shown in FIGS. 8 and 9 can be applied in consideration of the reference voltage Vref, a power source voltage Vdd, and the threshold voltage of the MOS transistor to be used.
Furthermore, in a case where the circuit shown in FIG. 8 or 9 is integrated into a semiconductor device for the purpose of freely setting the current value of the current iout, an external terminal T101 can be provided for externally connecting the resistor R101.    Patent Document 1: Japanese Laid-Open Patent Application No. 2006-33197    Patent Document 2: Japanese Laid-Open Patent Application No. 2006-18663
However, when the resistor R101 is externally connected, there may be cases where connection failures occur between the semiconductor device and the circuit board. Consequently, the resistor R101 may become disconnected from the external terminal T101, thus causing the external terminal T101 to be in an open state, or causing the external terminal T101 to become short-circuited to a ground voltage Vss and the power source voltage Vdd.
When the resistor R101 is disconnected from the external terminal T101 such that the external terminal T101 is in an open state, the output current iout may become extremely low or may not be output at all. Accordingly, the circuit to which the current is supplied may malfunction or stop operating, thereby causing unexpected failures in the circuit of the semiconductor device.
Furthermore, when the external terminal T101 short-circuits to the ground voltage Vss, the PMOS transistor M102 that supplies the output current iout is completely turned on, and therefore the output current iout significantly increases. As a result, the load circuit to which the current is supplied may malfunction and overheat. Furthermore, the PMOS transistor M102, which is outputting the output current iout, may overheat and malfunction due to the increased current.